Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with networkx 2.0 #792

Merged
merged 1 commit into from
Oct 6, 2017

Conversation

lukeshingles
Copy link
Member

Updating the networkx package to version 2.0 resulted in the following error:

Traceback (most recent call last):
  File "/usr/local/bin/tardis", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/Users/lshingles/Dropbox/GitHub/tardis/scripts/tardis", line 67, in <module>
    simulation = Simulation.from_config(tardis_config)
  File "/Users/lshingles/Dropbox/GitHub/tardis/tardis/simulation/base.py", line 353, in from_config
    atom_data=kwargs.get('atom_data', None))
  File "/Users/lshingles/Dropbox/GitHub/tardis/tardis/plasma/standard_plasmas.py", line 147, in assemble_plasma
    property_kwargs=property_kwargs, **kwargs)
  File "/Users/lshingles/Dropbox/GitHub/tardis/tardis/plasma/base.py", line 27, in __init__
    self.update(**kwargs)
  File "/Users/lshingles/Dropbox/GitHub/tardis/tardis/plasma/base.py", line 160, in update
    for module_name in self._resolve_update_list(kwargs.keys()):
  File "/Users/lshingles/Dropbox/GitHub/tardis/tardis/plasma/base.py", line 195, in _resolve_update_list
    descendants_ob.sort(key=lambda val: sort_order.index(val) )
  File "/Users/lshingles/Dropbox/GitHub/tardis/tardis/plasma/base.py", line 195, in <lambda>
    descendants_ob.sort(key=lambda val: sort_order.index(val) )
AttributeError: 'generator' object has no attribute 'index'

I've fixed the error by converting the generator to a list.

@wkerzendorf
Copy link
Member

@lukeshingles interesting - does this also work with the lower versions?

@lukeshingles
Copy link
Member Author

Yes - it works on the tardis example config at least. I'm not able to get the full set of tests running locally yet.

tardis_env27.yml Outdated
@@ -16,7 +16,7 @@ dependencies:
- astropy=1.3
- numexpr=2.6
- Cython=0.21
- networkx=1.10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukeshingles can you just leave the version - I think your fix should work with both

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. (Sorry, I think I broke your code review comment when I rebased the branch)

@lukeshingles lukeshingles changed the title Update networkx to 2.0 and fix error Fix compatibility with networkx 2.0 Oct 6, 2017
@wkerzendorf wkerzendorf merged commit 2a76d42 into tardis-sn:master Oct 6, 2017
@lukeshingles lukeshingles deleted the update_networkx_to_2.0 branch October 6, 2017 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants